package org.lee.basic;

/**
 * @author jackielee
 * @version 1.0
 * @description DemoCls
 * @date 2021/4/19
 */
public class DemoCls {

  public class Basic {
    private String name;

    public String getName() {
      return name;
    }

    public void setName(String name) {
      this.name = name;
    }

    public Basic() {}

    public Basic(String name) {
      this.name = name;
    }

    public String doIt() {
      String str = "now you can do it:" + getName();
      System.out.println(str);
      return str;
    }
  }

  public class Demo1 extends Basic {
    @Override
    public String doIt() {
      System.out.println("Demo1 do it");
      return super.doIt();
    }
  }

  public class Basic1 {
    private String name;

    public Basic1(String name) {
      this.name = name;
    }

    public String getName() {
      return name;
    }
  }

  public class Demo2 extends Basic1 { // 如父类只有构造方法，子类必须重写

    public Demo2(String name) {
      super(name);
    }
  }
}
